package service;

import bean.User;
import dao.UserDAO;

public class UserServiceImpl implements UserService {
    private UserDAO userDAO;

    public UserDAO getUserDAO() {
        return userDAO;
    }

    public void setUserDAO(UserDAO userDAO) {
        this.userDAO = userDAO;
    }

    @Override
    public boolean register(User user) {
        return userDAO.save(user);
    }

    @Override
    public int verify(User user) {
        return userDAO.find(user);
    }

    @Override
    public boolean verify(String userName) {
        return userDAO.find(userName);
    }

    @Override
    public boolean modify(int userId, String newPassword) {
        return userDAO.update(userId, newPassword);
    }

    @Override
    public boolean cancel(int userId) {
        return userDAO.delete(userId);
    }
}
